
import request from '@/utils/request'

export default {
  getGoodListPage(current, size, gName, gCategoryId, gHot) {
    return request.get('/good/listpage', {
      params: { current, size, gName, gCategoryId, gHot }
    })
  },
  getCategoryListPage(current = 1, size = 10) {
    return request.get('/good/getcategorypage', {
      params: { current, size }
    })
  },
  getCustomer(current,size) {
    return request.get('/staff/getcustomer',{
      params: {current,size}
    })
  },
   getType() {
    return request.get('/good/gettype')
  },
   getGoodByCategory(cName) {
    return request.get('/good/getgoodbycategory', {
      params: { cName }
    })
  },
  addGood(data) {
    return request.post('/good/insertgood', data)
  },
  getCategoryList() {
    return request.get('/good/getcategory')
  },
   addAdmin(staffEntity) {
    return request.post('/staff/insertuser', staffEntity)
  },
  addType(type) {
    return request.post('/good/inserttype', type)
  },
  addCategory(category) {
    return request.post('/good/insertcategory', category)
  },
   deleteGoodsByIds(ids) {
    const idsStr = ids.join(',') 
    return request.delete(`/good/deletebyids/${idsStr}`)
  }, 
  deleteCategoryByIds(ids) {
    const idsStr = ids.join(',')
    return request.delete(`/good/deletecategorybyids/${idsStr}`)
  },
   deleteTypeById(ids) {
    const idsStr = Array.isArray(ids) ? ids.join(',') : ids;
    return request.delete(`/good/deletetype/${idsStr}`);
  },
  
  
  deleteAdmins(ids) {
  const idsStr = ids.join(',') 
  return request.delete(`/staff/deletebyids/${idsStr}`)
  },
  getNumber() {
    return request.get('/staff/getnumber')
  },

  getTypeById(id) {
  return request.get('/good/gettypebyid', { params: { id } });
  },
 updateGood(data) {
  return request.post('/good/updategood', data);
 },
  updateUser(staffVo) {
    return request.post('/staff/updateById', staffVo)
  },
  updateCategory(category) {
    return request.post('/good/updatecategory', category)
  },
  getAllPosition() {
    return request.get('/staff/getallposition')
  },
  getPositionByUsername(username) {
  return request.post('/staff/getposition', {}, {
    params: { u_username: username }
  })
}


}